﻿
//
//  TSOL.SandboxWebservice
//
Type.registerNamespace("SandboxWebservice");


SandboxWebservice.Net = function(sandboxWebServiceUrl, sandboxWebserviceMethodName) {
    this._sandboxWebServiceUrl = sandboxWebServiceUrl;
    this._sandboxWebserviceMethodName  =  sandboxWebserviceMethodName;
    this._callbackFunction = null;
}

SandboxWebservice.Net.prototype = {
   
    ExecuteQuery: function(parameter, callbackFunction) {
        var request = new Sys.Net.WebRequest(); 
        var _sandboxWebServiceValues = {};
        _sandboxWebServiceValues['op'] = this._sandboxWebserviceMethodName;
        _sandboxWebServiceValues['parameters'] = parameter;

        request.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
        var _sandboxWebServiceRequestUrl = this._sandboxWebServiceUrl + '?' + Sys.Net.WebRequest._createQueryString(_sandboxWebServiceValues, null);
        request.add_completed(function(response) {callbackFunction(response.get_object());});
        request.set_url(_sandboxWebServiceRequestUrl);

        request.invoke();  
    }
    
 } 

